﻿using System;
using System.Diagnostics;
using System.Windows.Forms;
using RayDen.Library.Components.SystemComponents;
using RayDen.SceneLab.Components;
using RayDen.SceneLab.Controllers.FormControllers;

namespace RayDen.SceneLab
{
    public partial class LogForm : Form
    {
        public LogFormController Controller;

        public LogForm()
        {
            InitializeComponent();
            if (ApplicationContext.Instance.TextBoxListener == null)
            {
                ApplicationContext.Instance.TextBoxListener = new TextBoxTraceListener(this.txtLog);
                TracerFactory.Instance.Populate(ApplicationContext.Instance.TextBoxListener);
                Trace.Listeners.Add(ApplicationContext.Instance.TextBoxListener);
            }
            Controller = new LogFormController(this);
            txtLog.Text = ApplicationContext.Instance.TextBoxListener.LogData;
        }

        protected override void OnShown(System.EventArgs e)
        {
            base.OnShown(e);
            this.groupBox1.Text = DateTime.Now.ToString();
        }
    }
}
